/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.dengues.model.database.impl;

import org.dengues.model.database.DatabasePackage;
import org.dengues.model.database.SectionUnions;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Section Unions</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.dengues.model.database.impl.SectionUnionsImpl#getUnion <em>Union</em>}</li>
 *   <li>{@link org.dengues.model.database.impl.SectionUnionsImpl#getQueries <em>Queries</em>}</li>
 *   <li>{@link org.dengues.model.database.impl.SectionUnionsImpl#isChecked <em>Checked</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SectionUnionsImpl extends AbstractDBObjectImpl implements SectionUnions {
    /**
     * The default value of the '{@link #getUnion() <em>Union</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getUnion()
     * @generated
     * @ordered
     */
    protected static final String UNION_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getUnion() <em>Union</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getUnion()
     * @generated
     * @ordered
     */
    protected String union = UNION_EDEFAULT;

    /**
     * The default value of the '{@link #getQueries() <em>Queries</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getQueries()
     * @generated
     * @ordered
     */
    protected static final String QUERIES_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getQueries() <em>Queries</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getQueries()
     * @generated
     * @ordered
     */
    protected String queries = QUERIES_EDEFAULT;

    /**
     * The default value of the '{@link #isChecked() <em>Checked</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #isChecked()
     * @generated
     * @ordered
     */
    protected static final boolean CHECKED_EDEFAULT = false;

    /**
     * The cached value of the '{@link #isChecked() <em>Checked</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #isChecked()
     * @generated
     * @ordered
     */
    protected boolean checked = CHECKED_EDEFAULT;

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected SectionUnionsImpl() {
        super();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected EClass eStaticClass() {
        return DatabasePackage.Literals.SECTION_UNIONS;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getUnion() {
        return union;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setUnion(String newUnion) {
        String oldUnion = union;
        union = newUnion;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, DatabasePackage.SECTION_UNIONS__UNION, oldUnion, union));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getQueries() {
        return queries;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setQueries(String newQueries) {
        String oldQueries = queries;
        queries = newQueries;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, DatabasePackage.SECTION_UNIONS__QUERIES, oldQueries, queries));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isChecked() {
        return checked;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setChecked(boolean newChecked) {
        boolean oldChecked = checked;
        checked = newChecked;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, DatabasePackage.SECTION_UNIONS__CHECKED, oldChecked, checked));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case DatabasePackage.SECTION_UNIONS__UNION:
                return getUnion();
            case DatabasePackage.SECTION_UNIONS__QUERIES:
                return getQueries();
            case DatabasePackage.SECTION_UNIONS__CHECKED:
                return isChecked() ? Boolean.TRUE : Boolean.FALSE;
        }
        return super.eGet(featureID, resolve, coreType);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case DatabasePackage.SECTION_UNIONS__UNION:
                setUnion((String)newValue);
                return;
            case DatabasePackage.SECTION_UNIONS__QUERIES:
                setQueries((String)newValue);
                return;
            case DatabasePackage.SECTION_UNIONS__CHECKED:
                setChecked(((Boolean)newValue).booleanValue());
                return;
        }
        super.eSet(featureID, newValue);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void eUnset(int featureID) {
        switch (featureID) {
            case DatabasePackage.SECTION_UNIONS__UNION:
                setUnion(UNION_EDEFAULT);
                return;
            case DatabasePackage.SECTION_UNIONS__QUERIES:
                setQueries(QUERIES_EDEFAULT);
                return;
            case DatabasePackage.SECTION_UNIONS__CHECKED:
                setChecked(CHECKED_EDEFAULT);
                return;
        }
        super.eUnset(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean eIsSet(int featureID) {
        switch (featureID) {
            case DatabasePackage.SECTION_UNIONS__UNION:
                return UNION_EDEFAULT == null ? union != null : !UNION_EDEFAULT.equals(union);
            case DatabasePackage.SECTION_UNIONS__QUERIES:
                return QUERIES_EDEFAULT == null ? queries != null : !QUERIES_EDEFAULT.equals(queries);
            case DatabasePackage.SECTION_UNIONS__CHECKED:
                return checked != CHECKED_EDEFAULT;
        }
        return super.eIsSet(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String toString() {
        if (eIsProxy()) return super.toString();

        StringBuffer result = new StringBuffer(super.toString());
        result.append(" (union: ");
        result.append(union);
        result.append(", queries: ");
        result.append(queries);
        result.append(", checked: ");
        result.append(checked);
        result.append(')');
        return result.toString();
    }

} //SectionUnionsImpl
